package com.avery.util;


import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class DBUtils{   
    
	private static SqlSessionFactory sqlSessionFactory;
  
    public static synchronized SqlSessionFactory getSqlSessionFactory()    
    {      
          if(sqlSessionFactory==null)    
          {    
              try {    
                  Reader reader = Resources.getResourceAsReader("Configration.xml");    
                  sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
                  reader.close();    
                } catch (IOException e) {    
                    e.printStackTrace();    
                }    
          }
            return sqlSessionFactory;    
    } 
} 
